#pragma strict
//////////////////////////////////////////////////////
///Projector 渐进消失
//////////////////////////////////////////////////////

var projector:Projector;

var lifeTime:float = 4;

var remainTime:float;

private var shadowMap:Texture2D;
function Start () {
	projector = GetComponent.<Projector>();
	remainTime = lifeTime;
}

function Update(){
	remainTime -= Time.deltaTime;
	if(remainTime <= 0){
		Destroy(gameObject);
	}else{
		FadeOut();
	}
}

private function FadeOut(){
	var ratio:float = remainTime/lifeTime;
	projector.material.color.a = ratio;
}